package com.atguigu.utils;

public class MySqlUtil {
    //获取动态表连接mysql的base_dic用于lookup join
    public static String getBaseDicDDL(){
        return "create table base_dic(" +
                "dic_code string," +
                "dic_name string," +
                "parent_code string)"+getMysqlConnctionDDL("base_dic");
    }

    //利用jdbc连接mysql
    public static String getMysqlConnctionDDL(String tableName){
        return "WITH (\n" +
                "   'connector' = 'jdbc',\n" +
                "   'url' = 'jdbc:mysql://hadoop102:3306/gmall',\n" +
                "   'table-name' = '"+tableName+"',\n" +
                "   'username'='root'," +
                "   'password'='123456'," +
                "   'lookup.cache.max-rows'='10'," +
                "   'lookup.cache.ttl'='1 hour'"+
                ")";
    }
}
